package net.cmkj.mine.common.taglib;

import javax.servlet.http.HttpServletRequest;

import org.beetl.core.Tag;

import net.cmkj.mine.bean.SysRes;
import net.cmkj.mine.bean.SysUser;
import net.cmkj.mine.util.IWebUtils;

public class MenuTagHtml extends Tag {

	@Override
	public void render() {
		try {
			HttpServletRequest request = (HttpServletRequest) ctx.getGlobal("request");
			SysUser sysUser = IWebUtils.getCurrentSysUser(request);
			if (sysUser != null) {
				int uid = sysUser.getId();
				String menuView = SysRes.dao.getSysUserMenuView(uid);
				ctx.byteWriter.writeString(menuView);
			} else {
				ctx.byteWriter.writeString("");
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

}
